package com.kong.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * BCryptPasswordEncoder 加密工具类
 * @author yang2013
 * @data 2020/10/19 10:23
 */
public class BCryUtils {
    private static BCryptPasswordEncoder encoder;
    static {
         encoder = new BCryptPasswordEncoder();
    }

    public static String encode(String password){
        return encoder.encode(password);
    }

    public static boolean checkPwd(String password,String encodedPwd){
        return encoder.matches(password,encodedPwd);
    }
}
